﻿/*!	@file	r_window_Qtdx11.cpp
	@brief	ゲームウィンドウ(QtDirectX11版
Copyright (c) 2010 Yuya Yamaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "r_window_Qtdx11.h"

#if R_TARGET_UNIQUEIS(R_TARGET_UNIQUE_WINDX11) && R_TARGET_COMMON_WINDOWS
#if defined(RDEBUG_DEVELOP_BUILD)

#include "../r_window_systeminfo.h"
#include "../../r_debug.h"
#include "../../alloc/r_alloc_new_delete.h"
#include "../../thread/r_thread_server.h"
#include "../../draw/r_draw_core.h"
#include "../../input/r_input_server.h"
#include "../../gui/r_gui_server.h"

cRWindowQtDX11 :: cRWindowQtDX11(void)
{
}

cRWindowQtDX11 :: ~cRWindowQtDX11(void)
{
}

void	cRWindowQtDX11 :: init()
{
}
void	cRWindowQtDX11 :: cleanup()
{
}

r_bool	cRWindowQtDX11 :: preExec( void )
{
	{
		r_si32 width;
		r_si32 height;
		cRWindowSystemInfo winfo;
		winfo.getWindwowSize ( width,  height );
		setWindowSize( width, height );
	}
	r_si32	err				= 0;

	// スレッドの初期化
	r::thread::Server::create();

	// 描画コアの初期化
	r::draw::Core::create();
	r::draw::Core::instance	drawinst;
	err += drawinst->checkErr();

	// 入力関係の初期化
	r::input::Server::create();

	// GUIの初期化
	r::gui::Server::create();

	if(err > 0){return false;}
	QObject::connect( &timer, SIGNAL( timeout() ), this, SLOT( idle() ) );
	show();

	return true;
}

r_bool	cRWindowQtDX11 :: postExec( void )
{
	r::gui::Server::destroy();
	r::input::Server::destroy();
	r::draw::Core::destroy();
	r::thread::Server::destroy();
	return true;
}

#endif // defined(RDEBUG_DEVELOP_BUILD)
#endif // R_TARGET_UNIQUEIS(R_TARGET_UNIQUE_WINDX11)
